﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using ServiceOTO.Entity;

namespace ServiceOTO.Dataaccess
{
    public class USER_DATAACCESS
    {
        private static string sp_Name = "USER_LOGIN";
        public static bool GETDATATABLENONE(string ACTION,USER_ENTITY en)
        {
            SqlCommand com = new SqlCommand();
            DATABASE_CONTROL csdl = new DATABASE_CONTROL();
            DataSet ds;
            try
            {

                com.Connection = csdl.CheckConnect();
                com.Parameters.AddWithValue("ACTION", ACTION);
                if (en != null)
                {
                    com.Parameters.AddWithValue("USERNAME", en.USERNAME);
                    com.Parameters.AddWithValue("PASSWORD", en.PASSWORD);
                }
                com.CommandType = CommandType.StoredProcedure;
                com.CommandText = sp_Name;
                if (com.Connection.State == ConnectionState.Closed)
                {
                    com.Connection.Open();
                }
                ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(com);
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0) return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                return false;
                throw ex;
            }
            finally
            {
                com.Connection.Close();
            }
        }
    }
}